<template>
  <div>
    <div style="height:200px">
    <!--上层元素设置高度，不然无法显示-->
      <mt-swipe :auto="4000">
        <mt-swipe-item>
          <img class="image" src="https://www.ycbg.vip/group1/M00/00/01/rBD0tF6Gs_GALTEhAAzcEsZfGVA978.jpg" alt=""/>
        </mt-swipe-item>
        <mt-swipe-item>
          <img class="image" src="https://www.ycbg.vip/group1/M00/00/01/rBD0tF6Gs_KAcxLLAA09GUFy0Po560.jpg" alt=""/>
        </mt-swipe-item>
        <mt-swipe-item>
          <img class="image" src="https://www.ycbg.vip/group1/M00/00/01/rBD0tF6Gs_GADPPxABB7NNkAXbk530.jpg" alt=""/>
        </mt-swipe-item>
        <mt-swipe-item>
          <img class="image" src="https://www.ycbg.vip/group1/M00/00/01/rBD0tF6Gs_KASeGsAA7bJh9GYiI769.jpg" alt=""/>
        </mt-swipe-item>
      </mt-swipe>
    </div>
    <div v-html="this.dataForm.introduce" style="padding-left: 10px;padding-right: 5px"></div>
    <mt-button size="large" type="primary"
               @click.native="isMpUser" style="position: fixed; bottom:0;">注册成为会员
    </mt-button>
  </div>
</template>

<script>
  export default {
    mounted () {
      this.getDataList()
    },
    data () {
      return {
        superiorType: '',
        superiorId: '',
        dataForm: {
          name: '',
          introduce: '',
          status: 0,
          def0: '',
          def1: '',
          def2: ''
        }
      }
    },
    methods: {
      // 访问地址http://localhost:8001/#/activityHome?superiorType=0&superiorId=697025573054054400
      getDataList () {
        let superiorId = this.superiorId = this.$route.query.superiorId
        let superiorType = this.superiorType = this.$route.query.superiorType
        let actionName = ``
        if (superiorType === '0') {
          actionName = `/tra/activity/wapHome/unit/${superiorId}`
        } else {
          actionName = `/tra/activity/wapHome/globalActivity`
        }
        this.$http({
          url: this.$http.adornUrl(actionName),
          method: 'get',
          params: this.$http.adornParams()
        }).then(({data}) => {
          if (data && data.code === 0) {
            this.dataForm.name = data.activity[0].name
            this.dataForm.introduce = data.activity[0].introduce
            this.dataForm.status = data.activity[0].status
            this.dataForm.def0 = data.activity[0].def0
            this.dataForm.def1 = data.activity[0].def1
            this.dataForm.def2 = data.activity[0].def2
          }
        })
      },
      isMpUser () {
        this.$http({
          url: this.$http.adornUrl('/mp/user/getOauth2URL'),
          method: 'get',
          params: this.$http.adornParams({
            'superiorType': this.superiorType,
            'superiorId': this.superiorId
          })
        }).then(({data}) => {
          window.location.href = data
        })
      }
    }
  }
</script>

<style scoped>

  .image{
    width: 100%;height: 100%;
  }
</style>
